import {sso_login} from "@/plugins/sso-login";

export const state = () => ({
  counter: 0,//测试用

  imgBaseUrl: '../assets/img/',
  dialogBoxShow: false,
  // navShow:true,
  searchResultType: 0,//搜索结果页类型 1、正常 2、我的订阅 3、我的收藏
  sideBarShow: true,//是否显示侧边栏
  sideBarActiveIndex: 0,//当前选中的侧边栏的index
  // loginDialogShow:false,//是否显示登录组件
  subscriberShow: false,//是否显示订阅器组件
  token: '',
  nickName: '',
  tel: '',
  hasNewMessage: false,
  subscriberMessageNum: 0,
  openMemberShow: false
})

export const mutations = {
  increment(state) {//测试用
    state.counter++
  },
  changeLoginDialogShow(state, bool) {
    // state.loginDialogShow = bool;
    sso_login()
  },
  changeSubscriberShow(state, bool) {
    state.subscriberShow = bool;
  },
  changeOpenMemberShow(state, bool) {
    state.openMemberShow = bool;
  },
  changeSearchResultType(state, val) {
    state.searchResultType = val;
  },
  changeToken(state, token) {
    state.token = token;
  },
  changeNickName(state, nickName) {
    state.nickName = nickName;
  },
  changeTel(state, tel) {
    state.tel = tel;
  },
  changeDialogBoxShow(state, bool) {
    state.dialogBoxShow = bool;
  },
  changeHasNewMessage(state, bool) {
    state.hasNewMessage = bool;
  },
  changeSubscriberMessageNum(state, num) {
    state.subscriberMessageNum = num;
  },
  // 清除token
  clearToken(state) {
    state.token = ''
  },
  // 清除nickName
  clearNickName(state) {
    state.nickName = ''
  }
}
